//
//  ONEChatUserInfo.m
//  ONEChat
//
//  Created by 楼楚 on 15/12/16.
//  Copyright © 2015年 Chu Lou. All rights reserved.
//

#import "ONEChatUserInfo.h"
#define UserKey @"User"
#define LoginStatusKey @"LoginStatus"
#define pwdKey @"pwd"


@implementation ONEChatUserInfo
singleton_implementation(ONEChatUserInfo)
- (void)saveUserInfoToSanbox
{
    NSUserDefaults *defaults= [NSUserDefaults standardUserDefaults];
    [defaults setObject:self.user forKey:UserKey];
    [defaults setBool:self.loginStatus forKey:LoginStatusKey];
    [defaults setObject:self.pwd forKey:pwdKey];
    [defaults synchronize];
}

- (NSString *)jid
{
    return [NSString stringWithFormat:@"%@@%@",self.user,domain];
}

- (void)loadUserInfoFromSandbox
{
    
    NSUserDefaults *defaults= [NSUserDefaults standardUserDefaults];
    self.user = [defaults objectForKey:UserKey];
    self.loginStatus = [defaults boolForKey:LoginStatusKey];
    self.pwd = [defaults objectForKey:pwdKey];
    
}
@end
